﻿using System;
using System.Collections.Generic;

namespace BusinessLayer
{
    /// <summary>
    /// The driver.
    /// </summary>
    public class Driver : BusinessEntity
    {
        /// <summary>
        /// The driver repository.
        /// </summary>
        public class DriverRepository : Repository<Driver>
        {
            
        }

        /// <summary>
        /// The driver repository.
        /// </summary>
        public static DriverRepository Repository = new DriverRepository();

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        public string Name
        {
            get { return (string)this.Get("Name"); }
            set { this.Set("Name", value); }
        }

        /// <summary>
        /// Gets or sets the surname.
        /// </summary>
        public string Surname
        {
            get { return (string)this.Get("Surname"); }
            set { this.Set("Surname", value); }
        }

        /// <summary>
        /// Gets the id.
        /// </summary>
        public int Id
        {
            get { return (int)this.Get("Id"); }
        }

        /// <summary>
        /// Gets or sets the phone number.
        /// </summary>
        public string PhoneNumber
        {
            get { return (string)this.Get("PhoneNumber"); }
            set { this.Set("PhoneNumber", value); }
        }

        /// <summary>
        /// Gets or sets the email.
        /// </summary>
        public string Email
        {
            get { return (string)this.Get("Email"); }
            set { this.Set("Email", value); }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Car"/> class.
        /// </summary>
        internal Driver(Dictionary<string, object> car)
        {
            this.Initialize(car);
        }

        /// <summary>
        /// Default constructor.
        /// Must call Initialize method before using.
        /// </summary>
        public Driver()
        {
        }

        /// <summary>
        /// Save the driver.
        /// </summary>
        public override void Save()
        {
            Driver.Repository.Write(this);
        }
    }
}
